package com.example.travel.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;


import com.example.travel.R;

import java.util.ArrayList;

public class MySearchListViewAdapter extends BaseAdapter {
    private Context context;
    private ArrayList<Integer>imageView;
    private ArrayList<String>name;
    private ArrayList<String>price;
    private ArrayList<String>introduce;

    public MySearchListViewAdapter(Context context, ArrayList<Integer>imageView, ArrayList<String>name, ArrayList<String>price, ArrayList<String>introduce) {
        this.context = context;
        this.imageView = imageView;
        this.name = name;
        this.price = price;
        this.introduce = introduce;
    }

    @Override
    public int getCount() {
        return name.size();
    }

    @Override
    public Object getItem(int i) {
        return name.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        LinearLayout linearLayout = (LinearLayout)view.inflate(context, R.layout.browselistpro,null);
        ImageView imageView1 = linearLayout.findViewById(R.id.iv1);
        imageView1.setImageResource(imageView.get(i));
        TextView textView1_1 = linearLayout.findViewById(R.id.tx1_1);
        textView1_1.setText(name.get(i));
        TextView textView1_2 = linearLayout.findViewById(R.id.tx1_2);
        textView1_2.setText(price.get(i));
        TextView textView1_3 = linearLayout.findViewById(R.id.tx1_3);
        textView1_3.setText(introduce.get(i));
        return linearLayout;
    }
}
